package com.itheima.demo1exception;

public class ExceptionDemo2 {
    public static void main(String[] args)  {
        try {
            show(10,0);
            System.out.println("底层层运行成功");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        System.out.println("程序结束运行");
    }
    //定义一个除数方法
    public static int show(int a,int b) throws Exception {
        if(b==0)
        {
            System.out.println("参数b不能为0");
            //抛出异常
            throw new Exception("参数b不能为0");
        }
        int c=a/b;
        System.out.println(c);
        return c;
    }
}
